namespace Matrix.Configuration
{
    /// <summary>
    /// 配置管理选项
    /// </summary>
    public class ConfigurationOptions
    {
        /// <summary>
        /// 缓存过期时间（分钟）
        /// </summary>
        public int CacheExpirationMinutes { get; set; } = 60;

        /// <summary>
        /// 是否启用分布式事件
        /// </summary>
        public bool EnableDistributedEvents { get; set; } = false;

        /// <summary>
        /// 默认命名空间
        /// </summary>
        public string DefaultNamespace { get; set; } = "default";

        /// <summary>
        /// 最大配置值长度
        /// </summary>
        public int MaxValueLength { get; set; } = 4000;

        /// <summary>
        /// 是否启用配置验证
        /// </summary>
        public bool EnableValidation { get; set; } = true;

        /// <summary>
        /// 配置监控选项
        /// </summary>
        public MonitoringOptions Monitoring { get; set; } = new();

        /// <summary>
        /// 热更新选项
        /// </summary>
        public HotReloadOptions HotReload { get; set; } = new();
    }

    /// <summary>
    /// 配置监控选项
    /// </summary>
    public class MonitoringOptions
    {
        /// <summary>
        /// 是否启用配置监控
        /// </summary>
        public bool Enabled { get; set; } = true;

        /// <summary>
        /// 监控检查间隔（秒）
        /// </summary>
        public int MonitorIntervalSeconds { get; set; } = 30;

        /// <summary>
        /// 是否监控配置文件变更
        /// </summary>
        public bool WatchConfigurationFiles { get; set; } = true;

        /// <summary>
        /// 是否启用配置变更日志
        /// </summary>
        public bool EnableChangeLogging { get; set; } = true;

        /// <summary>
        /// 监控超时时间（秒）
        /// </summary>
        public int TimeoutSeconds { get; set; } = 60;

        /// <summary>
        /// 最大并发检查数
        /// </summary>
        public int MaxConcurrentChecks { get; set; } = 10;
    }

    /// <summary>
    /// 热更新选项
    /// </summary>
    public class HotReloadOptions
    {
        /// <summary>
        /// 是否启用热更新
        /// </summary>
        public bool Enabled { get; set; } = true;

        /// <summary>
        /// 热更新延迟（毫秒），避免频繁更新
        /// </summary>
        public int DelayMilliseconds { get; set; } = 500;

        /// <summary>
        /// 是否启用配置版本控制
        /// </summary>
        public bool EnableVersionControl { get; set; } = true;

        /// <summary>
        /// 最大保留配置版本数
        /// </summary>
        public int MaxVersions { get; set; } = 10;

        /// <summary>
        /// 是否在热更新失败时回滚
        /// </summary>
        public bool RollbackOnError { get; set; } = true;

        /// <summary>
        /// 热更新重试次数
        /// </summary>
        public int MaxRetryAttempts { get; set; } = 3;

        /// <summary>
        /// 热更新重试间隔（毫秒）
        /// </summary>
        public int RetryIntervalMilliseconds { get; set; } = 1000;
    }
}